home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d1
/
int_23.arc
/
INT23.ASM
next >
Wrap
Assembly Source File
|
1988-03-15
|
1KB
|
60 lines
; Static Name Aliases
;
TITLE int23
; NAME int23.asm
; This code, written in a rather paranoid fashion, allows one to post an
; int 23. If you try to do it with the standard int86() library call, you
; will generate an error, as the stack isn't properly restored.
;
; This code comes from a complete ARC file with a demonstration program and
; documentation. If you do not have the whole ARC, it is available from the
; MSOFT forum on CompuServe.
_TEXT SEGMENT BYTE PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT WORD PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT WORD PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT WORD PUBLIC 'BSS'
save_ss dw ?
save_sp dw ?
_BSS ENDS
DGROUP GROUP CONST, _BSS, _DATA
ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
_TEXT SEGMENT
PUBLIC _int23
_int23 PROC NEAR
push bp ; save bp
mov bp,sp ; setup stack frame to allow CV walkback
push di
push si
push ds
push es
mov save_sp,sp ; sp needs to be stored in a safe place
mov save_ss,ss ; ss also needs to be stored somewhere safe
int 23h ; post a ^C interrupt
cli ; old chips had a bug that requires this
mov ss,save_ss ; ss can now be restored from it's hiding place
mov sp,save_sp ; sp needs to be restored, too
sti ; other end of hardware bug fix
pop es
pop ds
pop si
pop di
pop bp ; do NOT issue a mov sp,bp - bp is unreliable
ret
_int23 ENDP
_TEXT ENDS
END